<template>
  <van-popup
    v-model:show="showSelectShip"
    position="bottom"
    round
    :style="{ height: 'auto' }"
  >
    <SelectShip @isOpen="isOpen" @selectedShip="selectedShip"></SelectShip>
  </van-popup>
  <div>
    <van-cell-group inset>
      <van-field v-model="shipInfo" center readonly label="船">
        <template #button>
          <van-button size="small" type="primary" @click="showPopup"
            >选择
          </van-button>
        </template>
      </van-field>
    </van-cell-group>
  </div>
  <div class="demo-main">
    <van-button @click="goback">返回</van-button>
  </div>
</template>
<script setup lang="ts" name="Test">
import { ref } from "vue";
import router from "@/router";
import SelectShip from "@/components/SelectInfo/SelectShip.vue";

const showSelectShip = ref(true);
const shipInfo = ref();

const isOpen = (value: boolean) => {
  showSelectShip.value = value;
};

const selectedShip = (value: any) => {
  shipInfo.value = value;
};

function showPopup() {
  showSelectShip.value = true;
}
const goback = () => {
  router.replace("/login");
};
</script>
